﻿@model SlideModel
@inject IEnumTranslationService EnumTranslation
<script>
        $(document).ready(function () {
            $("#@Html.IdFor(model => model.SliderTypeId)").change(toggleSliderType);
            toggleSliderType();
        });
        function toggleSliderType() {
            var sliderTypeId = $("#@Html.IdFor(model => model.SliderTypeId)").val();
            if (sliderTypeId == @(((int)SliderType.HomePage).ToString())) {
                $('#pnlCategory').hide();
                $('#pnlCollection').hide();
                $('#pnlBrand').hide();
            } else if (sliderTypeId == @(((int)SliderType.Category).ToString())) {
                $('#pnlCategory').show();
                $('#pnlCollection').hide();
                $('#pnlBrand').hide();
            }else if (sliderTypeId == @(((int)SliderType.Collection).ToString())) {
                $('#pnlCategory').hide();
                $('#pnlCollection').show();
                $('#pnlBrand').hide();
            }
            else if (sliderTypeId == @(((int)SliderType.Brand).ToString())) {
                $('#pnlCategory').hide();
                $('#pnlCollection').hide();
                $('#pnlBrand').show();
            }
        }
</script>
@{
    Func<int, HelperResult> template = @<div class="form-horizontal">
        <div class="form-body">
            <div class="form-group">
                <admin-label asp-for="@Model.Locales[item].Name"/>
                <div class="col-md-9 col-sm-9">
                    <admin-input asp-for="@Model.Locales[item].Name"/>
                    <span asp-validation-for="@Model.Locales[item].Name"></span>
                </div>
            </div>
            <div class="form-group">
                <admin-label asp-for="@Model.Locales[item].Description"/>
                <div class="col-md-9 col-sm-9">
                    <admin-input asp-for="@Model.Locales[item].Description" asp-template="Editor"/>
                    <span asp-validation-for="@Model.Locales[item].Description"></span>
                </div>
            </div>
            <input type="hidden" asp-for="@Model.Locales[item].LanguageId"/>
        </div>
    </div>;
}
<div class="form-horizontal">
    <localized-editor localized-template="@template" name="slide-info-localized" language-ids="@Model.Locales.Select(c => c.LanguageId).ToList()">
        <div class="form-body">
            <div class="form-group">
                <admin-label asp-for="Name"/>
                <div class="col-md-9 col-sm-9">
                    <admin-input asp-for="Name"/>
                    <span asp-validation-for="Name"></span>
                </div>
            </div>
            <div class="form-group">
                <admin-label asp-for="Description"/>
                <div class="col-md-9 col-sm-9">
                    <admin-input asp-for="Description" asp-template="Editor"/>
                    <span asp-validation-for="Description"></span>
                </div>
            </div>
        </div>
    </localized-editor>
    <div class="form-body">
        <div class="form-group">
            <admin-label asp-for="PictureId"/>
            <div class="col-md-9 col-sm-9">
                <admin-input asp-for="PictureId"/>
                <span asp-validation-for="PictureId"></span>
            </div>
        </div>
        <div class="form-group">
            <admin-label asp-for="Link"/>
            <div class="col-md-9 col-sm-9">
                <admin-input asp-for="Link"/>
                <span asp-validation-for="Link"></span>
            </div>
        </div>
        <div class="form-group">
            <admin-label asp-for="Published"/>
            <div class="col-md-9 col-sm-9">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="Published"/>
                    <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="Published"></span>
            </div>
        </div>
        <div class="form-group">
            <admin-label asp-for="Stores"/>
            <div class="col-md-9 col-sm-9">
                <admin-input asp-for="Stores"/>
                <span asp-validation-for="Stores"></span>
            </div>
        </div>
        <div class="form-group">
            <admin-label asp-for="FullWidth"/>
            <div class="col-md-9 col-sm-9">
                <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                    <admin-input asp-for="FullWidth"/>
                    <div class="control__indicator"></div>
                </label>
                <span asp-validation-for="FullWidth"></span>
            </div>
        </div>
        <div class="form-group">
            <admin-label asp-for="SliderTypeId"/>
            <div class="col-md-9 col-sm-9">
                <admin-select asp-for="SliderTypeId" asp-items="@EnumTranslation.ToSelectList((SliderType)Model.SliderTypeId)"/>
                <span asp-validation-for="SliderTypeId"></span>
            </div>
        </div>
        <div class="form-group" id="pnlCategory">
            <admin-label asp-for="CategoryId"/>
            <div class="col-md-9 col-sm-9">
                <admin-input asp-for="CategoryId"/>
                <span asp-validation-for="CategoryId"></span>
            </div>
        </div>
        <div class="form-group" id="pnlCollection">
            <admin-label asp-for="CollectionId"/>
            <div class="col-md-9 col-sm-9">
                <admin-input asp-for="CollectionId"/>
                <span asp-validation-for="CollectionId"></span>
            </div>
        </div>
        <div class="form-group" id="pnlBrand">
            <admin-label asp-for="BrandId"/>
            <div class="col-md-9 col-sm-9">
                <admin-input asp-for="BrandId"/>
                <span asp-validation-for="BrandId"></span>
            </div>
        </div>
        <div class="form-group">
            <admin-label asp-for="DisplayOrder"/>
            <div class="col-md-9 col-sm-9">
                <admin-input asp-for="DisplayOrder"/>
                <span asp-validation-for="DisplayOrder"></span>
            </div>
        </div>
        <div class="form-group">
            <admin-label asp-for="StartDateUtc"/>
            <div class="col-md-9 col-sm-9">
                <admin-input asp-for="StartDateUtc"/>
            </div>
        </div>
        <div class="form-group">
            <admin-label asp-for="EndDateUtc"/>
            <div class="col-md-9 col-sm-9">
                <admin-input asp-for="EndDateUtc"/>
            </div>
        </div>
    </div>
</div>